<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>父组件向子组件传递数据</title>
</head>
<body>
<div id="app">
    <cpn v-bind:info="info"></cpn>
</div>

<template id="cpn">
    <H1>{{ props.info }}</H1>
</template>

<script type="module">
    import {createApp, ref, defineComponent, defineProps} from "../../../js/vue.esm-browser.js";

    let cpn = defineComponent(
        {
            template: "#cpn",
            props: {
                info: String
            },
            setup(props) {
                console.log(props.info);
                return {
                    props
                }
            }
        }
    )

    let app = createApp(
        {
            setup() {
                let info = ref("Hello, Vue!")
                return {
                    info
                }
            }
        }
    );

    app.component("cpn", cpn)
    app.mount("#app")
</script>
</body>
</html>